package com.spzx.order.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.order.api.RemoteOrderService;
import com.spzx.order.api.domain.OrderInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * Description:
 *
 * @author Yanxinhao on 2024/12/30
 */
@Slf4j
@Component
public class RemoteOrderFallbackFactory implements FallbackFactory<RemoteOrderService> {
    @Override
    public RemoteOrderService create(Throwable cause) {
        return new RemoteOrderService() {
            @Override
            public R<OrderInfo> getByOrderNo(String orderNo,String source) {
                log.error("查询订单详情信息失败:{}", cause.getMessage());
                return R.fail("查询订单详情信息失败:" + cause.getMessage());
            }
        };
    }
}